<template>
	<view >
		<my-header bgColor="bg-gradual-blue" :isBack="true" >
			<block slot="backText">返回</block>
			<block slot="content">历史上的今天</block>
		</my-header>
		<view class="wrap col info"> 
            <view class="title">{{info.title}}</view>
            <view class="time">
                时间：{{info.date}}
            </view>
            <view class="content" >
                <view class="p" v-for="(item,index) in info.content" :key="index">{{item}}</view>
            </view>
            <view class="imgs" v-for="(item,index) in info.picUrl" :key="index" >
                <image class="img" mode="widthFix" :src="item.url"  />
                <view class="tit">{{item.pic_title}}</view>
            </view>
        </view>
        <loading v-if="!is_req"></loading>
		
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
                info:[],
                flg:0,
                is_req:false,
                isHome:0
			}
		},
		async onLoad(opt) {
            this.initData(opt.id)
		},
		methods: {
			async initData(id){
				const res= await uni.$request({
                   id,
                },"api/api/todayInfo")
                if (res.code==200) {
                    res.data.content=res.data.content.split("\n")
                    this.info=res.data
                    this.is_req=true
                } else{
                    uni.$err(res.msg,1)
                }
			},
		}
	}
</script>

<style lang="scss">
	@import "./main";
</style>